package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ClazzMapper {

    //班级列表分页查询
    public List<Clazz> list(String name, LocalDate begin, LocalDate end);

    //根据ID删除班级
    @Delete("delete from clazz where id = #{id}")
    void deleteById(Integer id);

    //添加班级
    @Insert("insert into clazz (name,room,begin_date,end_date,master_id,subject,create_time,update_time) values (#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
    void insertClazz(Clazz clazz);

    //根据班级ID查询
    @Select("select * from clazz where id = #{id}")
    Clazz getClazzById(Integer id);

    //修改班级
    void update(Clazz clazz);


    //查询所有班级
    @Select("select * from clazz")
    List<Clazz> findAll();
}
